import {createRouter, createWebHistory} from 'vue-router'

const routes = [{  // 根目录
  path: '/',
  redirect: '/login',
  hidden: true,
}, {  // 登录界面
  path: '/login',
  name: 'loginPage',
  hidden: true,
  component: () => import("@/components/LoginPage")
}, {  // 404 页面
  path: '/:pathMarch(.*)',
  name: 'notFound',
  hidden: true,
  component: () => import("@/components/NotFound")
}, {  // 主页
  path: '/home',
  name: '管理用户权限',
  iconClass: 'fa fa-users',
  redirect: '/home/user',
  component: () => import("@/components/HomePage"),
  children: [{  // 用户
    path: '/home/user',
    name: '用户列表',
    iconClass: 'fa fa-list',
    component: () => import("@/components/users/UserList"),
  }, {  // 用户组
    path: '/home/group',
    name: '用户组列表',
    iconClass: 'fa fa-list',
    component: () => import("@/components/users/GroupList"),
  }, {  // 角色
    path: '/home/role',
    name: '角色列表',
    iconClass: 'fa fa-list-alt',
    component: () => import("@/components/users/RoleList"),
  }, {  // 权限
    path: '/home/permission',
    name: '权限列表',
    iconClass: 'fa fa-list',
    component: () => import("@/components/users/PermissionList"),
  }, {  // 权限类型
    path: '/home/type',
    name: '权限类型',
    iconClass: 'fa fa-list-alt',
    component: () => import("@/components/users/TypeList"),
  },],
},];

const Router = new createRouter({
  history: createWebHistory(),
  routes,
});

export default Router;
